package com.itheima.random;

import java.util.Random;

public class RandomDemo1 {
    public static void main(String[] args) {
        Random random = new Random();
        for (int i = 0; i <= 10; i++) {
            int data = random.nextInt(10);
            System.out.println(data);
        }

        System.out.println("================");
        //生成1-10之间的随机数
        //nextInt(10)生成的随机数范围是[0,9],
        // 如果想生成[1,10]范围的随机数，需要+1,即nextInt(10)+1
        int data = random.nextInt(10) + 1;
        System.out.println(data);
    }
}
